#pragma once

#include <QObject>
#include <QScopedPointer>

class AbstractPlugin;

class PluginsManagerPrivate;
class PluginsManager : public QObject
{
    Q_OBJECT
public:
    explicit PluginsManager(QObject *parent = nullptr);
    ~PluginsManager();
    static PluginsManager *instance();

    QStringList pluginpaths();
    QList<AbstractPlugin*> plugins();
    AbstractPlugin *plugin();

public Q_SLOTS:
    void LoadAllPlugins();
    void UnloadAllPlugins();
    bool SetCurrentPlugin(const QString &plugin_name);

Q_SIGNALS:
    void PluginLoaded(const QString &modename, QWidget *widget, bool is_default = false);

private:
    const QScopedPointer<PluginsManagerPrivate> d_ptr;
    Q_DECLARE_PRIVATE(PluginsManager)
};
